﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;

namespace FluentUnity
{
    [AttributeUsage(AttributeTargets.Interface)]
    public class LifetimeAttribute : Attribute
    {
        public LifetimeAttribute(Type type)
        {
            Ensure.IsNotNull(() => type);

            if (!typeof (LifetimeManager).IsAssignableFrom(type))
                throw new ArgumentOutOfRangeException("Lifetime type is not derived from LifetimeManager: " + type.Name);
            Type = type;
        }

        public Type Type { get; protected set; }
    }
}